package com.service.impl;

import com.constant.Constant;
import com.dao.GoldPointsDao;
import com.entity.GoldPoints;
import com.exception.ServiceException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.service.GoldPointsService;
import com.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * date:2021/4/29
 * description:
 * Author:Stargazer
 */
@Service
public class GoldPointsServiceImpl implements GoldPointsService {
    @Autowired
   GoldPointsDao goldPointsDao;

    @Override
    @Transactional
    public void changeGPInfoByUserId(int user_id, int resource_user_id, int cost_number, int cost_type) throws ServiceException {

    }

    @Override
    public AjaxResult exchangeDold(int points, int id) {
        return null;
    }

    @Override
    public PageInfo findGoldPointByPageInNo(GoldPoints goldPoints, Integer pageNo) {
        PageHelper.startPage(pageNo, Constant.PAGE_SIZE);
        List<GoldPoints>goldPointsList= goldPointsDao.selectGoldPointPageNo(goldPoints);
        PageInfo<GoldPoints> info=new PageInfo<>(goldPointsList);
        System.out.println(goldPointsList);
        return info;
    }
}
